package com.goodving.guli.bt.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;

import com.goodving.guli.utility.C3657a;
import com.goodving.guli.view.C4220a;

/**
 * Created by john on 2015/12/5.
 */
public class C1593c {
    private static final String f7965a = "ShoesKeeper";
    private static final String f7966b = "SyncSystemDeviceToServer:";
    private static final String f7967c = "BoundState";
    private static final String f7968d = "RTStepCnt";
    private static final String f7969e = "StatisticTime";
    private static final String f7970f = "SyncRTStepTime";
    private static final String f7971g = "SyncDeviceTime";
    private static final int f7972h = 2;
    private static final int f7973i = 1;
    private static final String f7974j = "v";

    public static String m12648a(Context context, String str) {
        if (context == null) {
            return f7974j;
        }
        if (!TextUtils.isEmpty(str)) {
            return context.getSharedPreferences(f7965a, 4).getString(str + C4220a.ci + f7974j, f7974j);
        }
        throw new IllegalArgumentException();
    }

    public static void m12649a(Context context, int i) {
        if (context != null) {
            context.getSharedPreferences(f7965a, 4).edit().putInt(f7968d, i).commit();
        }
    }

    public static void m12650a(Context context, long j) {
        if (context != null) {
            context.getSharedPreferences(f7965a, 4).edit().putLong(f7969e, j).commit();
        }
    }

    public static void m12651a(Context context, String str, boolean z) {
        if (context != null) {
            SharedPreferences.Editor edit = context.getSharedPreferences(f7965a, 4).edit();
            edit.putInt(f7966b + str, z ? f7972h : f7973i);
            edit.commit();
        }
    }

    public static void m12652a(Context context, boolean z) {
        if (context != null) {
            context.getSharedPreferences(f7965a, 4).edit().putBoolean(f7967c, z).commit();
        }
    }

    public static boolean m12653a(Context context) {
        return context == null ? false : context.getSharedPreferences(f7965a, 4).getBoolean(f7967c, false);
    }

    public static boolean m12654a(Context context, String str, String str2) {
        return (context == null || TextUtils.isEmpty(str2) || TextUtils.isEmpty(str)) ? false : context.getSharedPreferences(f7965a, 4).edit().putString(str + C4220a.ci + f7974j, str2).commit();
    }

    public static int m12655b(Context context) {
        return context == null ? -1 : context.getSharedPreferences(f7965a, 4).getInt(f7968d, -1);
    }

    public static String m12656b(Context context, String str) {
        if (context == null) {
            return null;
        }
        if (!TextUtils.isEmpty(str)) {
            return context.getSharedPreferences(f7965a, 4).getString(str, C3657a.f18328f);
        }
        throw new IllegalArgumentException();
    }

    public static void m12657b(Context context, int i) {
    }

    public static void m12658b(Context context, long j) {
        if (context != null) {
            context.getSharedPreferences(f7965a, 4).edit().putLong(f7971g, j).commit();
        }
    }

    public static boolean m12659b(Context context, String str, String str2) {
        if (context == null || TextUtils.isEmpty(str2) || TextUtils.isEmpty(str)) {
            return false;
        }
        SharedPreferences sharedPreferences = context.getSharedPreferences(f7965a, 4);
        return TextUtils.isEmpty(sharedPreferences.getString(str, C3657a.f18328f)) ? sharedPreferences.edit().putString(str, str2).commit() : true;
    }

    public static int m12660c(Context context, String str) {
        return context == null ? 0 : context.getSharedPreferences(f7965a, 4).getInt(f7966b + str, 0);
    }

    public static long m12661c(Context context) {
        return context == null ? -1 : context.getSharedPreferences(f7965a, 4).getLong(f7969e, -1);
    }

    public static void m12662c(Context context, long j) {
        if (context != null) {
            context.getSharedPreferences(f7965a, 4).edit().putLong(f7970f, j).commit();
        }
    }

    public static long m12663d(Context context) {
        return context == null ? -1 : context.getSharedPreferences(f7965a, 4).getLong(f7971g, 0);
    }

    public static boolean m12664d(Context context, String str) {
        return context != null && context.getSharedPreferences(f7965a, 4).getInt(f7966b + str, 0) == f7972h;
    }

    public static long m12665e(Context context) {
        return context == null ? -1 : context.getSharedPreferences(f7965a, 4).getLong(f7970f, 0);
    }

    static void m12666f(Context context) {
        if (context != null) {
            context.getSharedPreferences(f7965a, 4).edit().clear().commit();
        }
    }
}
